home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
10113
/
10113.xpi
/
content
/
overlay.js
< prev
Wrap
Text File
|
2009-08-19
|
18KB
|
428 lines
var igoogletabremover = {
onLoad: function() {
// initialization code
this.initialized = true;
this.strings = document.getElementById("igoogletabremover-strings");
//Change verbage of enable disable based on preference
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var igtremover = document.getElementById("igoogletabremover-enable");
if (prefManager.getBoolPref("extensions.igoogletabremover.boolEnable")){
igtremover.label="Disable iGoogle Tab Remover" ;
}
else {
igtremover.label="Enable iGoogle Tab Remover" ;
}
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent)
appcontent.addEventListener("DOMContentLoaded", igoogletabremover.onPageLoad, true);
},
onMenuItemCommand: function(e) {
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var igtremover = document.getElementById("igoogletabremover-enable");
if (prefManager.getBoolPref("extensions.igoogletabremover.boolEnable")){
prefManager.setBoolPref("extensions.igoogletabremover.boolEnable",false);
igtremover.label="Enable iGoogle Tab Remover";
}
else {
prefManager.setBoolPref("extensions.igoogletabremover.boolEnable",true);
igtremover.label="Disable iGoogle Tab Remover";
}
},
onMenuItemCommand2: function(e) {
var newSS, styles='#doc3 td#col1, #footerwrap{ display: table-cell; }';
newSS=doc.createElement('link'); newSS.rel='stylesheet';
newSS.href='data:text/css,'+escape(styles);
doc.getElementsByTagName("head")[0].appendChild(newSS);
},
onPageLoad: function(aEvent) {
var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
if(doc.title.search("iGoogle") > -1){
if(doc.location.href.search("www.google.")>-1){
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (prefManager.getBoolPref("extensions.igoogletabremover.boolEnable")==true){
var sFullModeHeight = doc.getElementById("nhdrwrapsizer").offsetHeight + 'px';
//alert(sFullModeHeight);
var mydiv = doc.createElement('div');
mydiv.id='igoogletabremoverdivStayTopLeft';
mydiv.style.position='absolute';
mydiv.style.display='none';
mydiv.style.zIndex=1999;
mydiv.className='leftunselectedtab';
mydiv.style.borderStyle='outset';
mydiv.addEventListener('click',function (e) {
var el = doc.getElementById('igoogletabremoverdivStayTopLeft');
el.style.display='none';
},false);
var tbl = doc.createElement("table");
var row = doc.createElement("tr");
row.id='igoogleremoverRW';
var tabcell = doc.getElementById('col1');
var cell = tabcell.cloneNode(true);
tabcell.id='igoogleremoverMenucol1';
cell.id='igoogleremoverMenu';
row.appendChild(cell);
tbl.appendChild(row);
mydiv.appendChild(tbl);
var newSS, styles='#doc3 td#col1, #igooglefooteroriginal { display: none; }';
newSS=doc.createElement('link'); newSS.rel='stylesheet';
newSS.href='data:text/css,'+escape(styles);
doc.getElementsByTagName("head")[0].appendChild(newSS);
var objElement=doc.getElementById("doc3");
doc.getElementById('gsea').style.height='0px';
var myElement = doc.createElement('div');
myElement.id='igoogleremoverBTN';
myElement.style.width='100%';
myElement.style.zIndex=1999;
myElement.className='leftunselectedtab';
var myElementTable= doc.createElement('table');
myElementTable.width='100%';
var myElementTableRow= doc.createElement('tr');
var myElementTableCell1= doc.createElement('td');
myElementTableCell1.innerHTML=' <a href="#" style="text-decoration:none">iGoogle Tabs</a>';
myElementTableCell1.width='105px';
myElementTableRow.appendChild(myElementTableCell1);
/* Empty Cell */
var myElementTableCell3= doc.createElement('td');
myElementTableCell3.innerHTML=' ';
myElementTableRow.appendChild(myElementTableCell3);
//Timedyn Menu Added
//Signing
var mySig = doc.createElement('div');
mySig.className='tab_view_title';
mySig.id='igoogletabremoverSig';
mySig.style.marginLeft='5pt';
mySig.innerHTML='<hr/><a href="http://www.timedyn.com/igoogletabremover.htm" Title="This free addon provided to you by Timedyn.com" style="text-decoration:none;">Timedyn</a>';
mydiv.appendChild(mySig);
var tblSearchToggle=doc.createElement('table');
tblSearchToggle.style.display='none';
tblSearchToggle.width='85%';
tblSearchToggle.style.marginLeft='12pt';
//Row for Search Toggle
var trSearchToggle=doc.createElement('tr');
var tdSearchToggle1=doc.createElement('td');
var tdSearchToggle2=doc.createElement('td');
var inptSearchToggle=doc.createElement('input');
inptSearchToggle.id='igoogleremoverMenuSearchToggle';
inptSearchToggle.type='checkbox';
inptSearchToggle.style.float='left';
tdSearchToggle1.style.width='10px';
tdSearchToggle1.appendChild(inptSearchToggle);
var divSearchToggleText=doc.createElement('div');
divSearchToggleText.innerHTML='Search Bar';
divSearchToggleText.style.float='right';
tdSearchToggle2.appendChild(divSearchToggleText);
trSearchToggle.appendChild(tdSearchToggle1);
trSearchToggle.appendChild(tdSearchToggle2);
//Row for Header Resize
var trSearchToggle2=doc.createElement('tr');
//var tdSearchToggle1_2=doc.createElement('td');
var tdSearchToggle2_2=doc.createElement('td');
tdSearchToggle2_2.colSpan=2;
tdSearchToggle2_2.style.borderTop="1px solid";
var btnResizeHead=doc.createElement('div');
btnResizeHead.id='igoogleremoverBTNResizeHead';
btnResizeHead.innerHTML='<a href="#" style="text-decoration:none;text-align:center;">Resize Header</a>';
tdSearchToggle2_2.appendChild(btnResizeHead);
//trSearchToggle2.appendChild(tdSearchToggle1_2);
trSearchToggle2.appendChild(tdSearchToggle2_2);
tblSearchToggle.appendChild(trSearchToggle);
tblSearchToggle.appendChild(trSearchToggle2);
//Row for Minimize Tabs
var trSearchToggle3=doc.createElement('tr');
var tdSearchToggle2_3=doc.createElement('td');
tdSearchToggle2_3.colSpan=2;
tdSearchToggle2_3.style.borderTop="1px solid";
var btnMinimize=doc.createElement('div');
btnMinimize.id='igoogleremoverBTNMinimize';
btnMinimize.innerHTML='<a href="#" style="text-decoration:none;text-align:center;">Minimize Tabs</a>';
tdSearchToggle2_3.appendChild(btnMinimize);
//trSearchToggle3.appendChild(tdSearchToggle1_3);
trSearchToggle3.appendChild(tdSearchToggle2_3);
tblSearchToggle.appendChild(trSearchToggle3);
mySig.appendChild(tblSearchToggle);
var myElementTableCell2= doc.createElement('td');
myElementTableCell2.style.textAlign='right';
myElementTableCell2.id="igoogletabremoverdivSearchCell"
myElementTableCell2.innerHTML='<form action="http://www.google.com/cse" id="cse-search-box"><input type="hidden" name="cx" value="partner-pub-1486060006013891:uuafljtdej4" /><input type="hidden" name="ie" value="ISO-8859-1" /><input type="text" id="q" name="q" size="15" /><input type="submit" id="sa" name="sa" value="Search"/></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>';
myElementTableRow.appendChild(myElementTableCell2);
//Search Toggle
var myElementTableCell4= doc.createElement('td');
myElementTableCell4.width='10px';
var searchToggleDiv=doc.createElement("div");
searchToggleDiv.id='igoogletabremoversearchToggleDiv';
searchToggleDiv.innerHTML='<a href="#" style="text-decoration:none" Title="Click to toggle search On/Off."><<</a>';
searchToggleDiv.className='leftunselectedtab';
myElementTableCell4.appendChild(searchToggleDiv);
myElementTableRow.appendChild(myElementTableCell4);
myElementTable.appendChild(myElementTableRow);
myElement.appendChild(myElementTable);
if (prefManager.getIntPref('extensions.igoogletabremover.intHeadHeight')>0){
if (prefManager.getBoolPref("extensions.igoogletabremover.boolSearchToggle")==true){
myElementTableCell2.style.display='';
inptSearchToggle.checked=true;
}
else {
myElementTableCell2.style.display='none';
inptSearchToggle.checked=false;
}
}
objElement.insertBefore(myElement, objElement.firstChild);
myElementTableCell1.appendChild(mydiv);
//Toggle Header Height
var btnShowHead=doc.getElementById("igoogleremoverBTNShowHead");
var intHeaderHeight = prefManager.getIntPref('extensions.igoogletabremover.intHeadHeight')
if (intHeaderHeight == 460){
doc.getElementById("nhdrwrapsizer").style.minHeight= sFullModeHeight;
doc.getElementById("nhdrwrapsizer").style.height= sFullModeHeight;
}else
{
doc.getElementById("nhdrwrapsizer").style.minHeight= intHeaderHeight + 'px';
doc.getElementById("nhdrwrapsizer").style.height= intHeaderHeight + 'px';
if (intHeaderHeight<doc.getElementById('addstuff').offsetTop+doc.getElementById('addstuff').offsetHeight){
doc.getElementById('addstuff').style.display='none';
}
if (intHeaderHeight<doc.getElementById('btnG').offsetTop +doc.getElementById('btnG').offsetHeight){
doc.getElementById('gsea').style.display='none';
doc.getElementById("igoogletabremoverdivSearchCell").style.display='';
inptSearchToggle.checked=true;
}
}
/* Reenable Footer */
var objFoot=doc.getElementById("footerwrap");
var copyFoot = objFoot.cloneNode(true);
objFoot.id='igooglefooteroriginal';
copyFoot.style.display='';
doc.body.appendChild(copyFoot);
/* Check for tabStrip Minimize */
if (prefManager.getBoolPref('extensions.igoogletabremover.boolTabStrip')==false){
myElement.style.display='none';
var objGbar=doc.getElementById('gbar');
var myMax = doc.createElement('div');
myMax.style.cssFloat='right';
myMax.innerHTML='<a href="#" style="text-decoration:none;" title="Restore iGoogle Tab Remover"><small> ▼</small></a>';
objGbar.appendChild(myMax);
myMax.addEventListener('click',function (e) {
myElement.style.display='';
objGbar.removeChild(myMax);
prefManager.setBoolPref('extensions.igoogletabremover.boolTabStrip',true);
},false);
}
var dcid=tabcell.firstChild;
tabcell.removeChild(dcid);
searchToggleDiv.addEventListener('click',function (e) {
var el = doc.getElementById('igoogletabremoverdivSearchCell');
if (el.style.display=='none'){
el.style.display='';
prefManager.setBoolPref('extensions.igoogletabremover.boolSearchToggle',true);
inptSearchToggle.checked=true;
}
else {el.style.display='none';
prefManager.setBoolPref('extensions.igoogletabremover.boolSearchToggle',false);
inptSearchToggle.checked=false;
}
},false);
inptSearchToggle.addEventListener('click',function (e) {
var el = doc.getElementById('igoogletabremoverdivSearchCell');
if (inptSearchToggle.checked==true){
el.style.display='';
prefManager.setBoolPref('extensions.igoogletabremover.boolSearchToggle',true);
}
else {el.style.display='none';
prefManager.setBoolPref('extensions.igoogletabremover.boolSearchToggle',false);
}
},false);
myElementTableCell1.addEventListener('mouseover',function (e) {
var el = doc.getElementById('igoogletabremoverdivStayTopLeft');
el.style.display='';
},false);
myElementTableCell1.addEventListener('mouseout',function (e) {
var el = doc.getElementById('igoogletabremoverdivStayTopLeft');
el.style.display='none';
},false);
mySig.addEventListener('mouseover',function (e) {
tblSearchToggle.style.display='';
},false);
mySig.addEventListener('mouseout',function (e) {
tblSearchToggle.style.display='none';
},false);
btnMinimize.addEventListener('click',function (e) {
myElement.style.display='none';
prefManager.setBoolPref('extensions.igoogletabremover.boolTabStrip',false);
var objGbar=doc.getElementById('gbar');
var myMax = doc.createElement('div');
myMax.style.cssFloat='right';
myMax.innerHTML='<a href="#" style="text-decoration:none;" title="Restore iGoogle Tab Remover"><small> ▼</small></a>';
objGbar.appendChild(myMax);
myMax.addEventListener('click',function (e) {
myElement.style.display='';
objGbar.removeChild(myMax);
prefManager.setBoolPref('extensions.igoogletabremover.boolTabStrip',true);
},false);
},false);
btnResizeHead.addEventListener('click',function (e) {
var tmpVar=doc.getElementById("nhdrwrapsizer");
tmpVar.style.minHeight= sFullModeHeight;
tmpVar.style.height= sFullModeHeight;
var coverDiv = doc.createElement('div');
coverDiv.style.position='absolute';
coverDiv.style.height='800px';
coverDiv.style.top='0';
coverDiv.style.left='0';
coverDiv.style.width='100%';
//coverDiv.style.zIndex='2000';
//coverDiv.innerHTML="abc";
doc.body.appendChild(coverDiv);
var positionDiv = doc.createElement('div');
positionDiv.style.zIndex='3000';
positionDiv.style.position='absolute';
positionDiv.style.top= tmpVar.offsetTop;
positionDiv.style.left='0';
positionDiv.style.width='100%';
positionDiv.style.backgroundColor='grey';
positionDiv.style.opacity='0.75';
var positionDivBTN = doc.createElement('div');
positionDivBTN.style.zIndex='3001';
positionDivBTN.style.position='absolute';
positionDivBTN.style.top=tmpVar.offsetTop;
positionDivBTN.style.left='0';
positionDivBTN.style.height='100%';
positionDivBTN.style.textAlign='center';
positionDivBTN.style.opacity='1';
var positionDivBTNOK = doc.createElement('div');
positionDivBTNOK.innerHTML='<input type="button" value="Finished"/>';
positionDivBTNOK.style.position='absolute';
positionDivBTNOK.style.float='left';
positionDivBTNOK.style.width='150px';
positionDivBTNOK.style.top= '-20px';
var positionDivBTNReset = doc.createElement('div');
positionDivBTNReset.style.zIndex='3001';
positionDivBTNReset.innerHTML='<input type="button" value="Reset"/>';
positionDivBTNReset.style.position='absolute';
positionDivBTNReset.style.float='right';
positionDivBTNReset.style.top=tmpVar.offsetTop;
positionDivBTNReset.style.left='140px';
positionDivBTNReset.style.top= '-20px';
var positionDivTxt = doc.createElement('div');
positionDivTxt.innerHTML='Click the header to resize.';
positionDivTxt.style.position='absolute';
positionDivTxt.style.float='right';
positionDivTxt.style.top='-20px';
positionDivTxt.style.left='210px';
positionDivTxt.style.backgroundColor='white';
positionDivTxt.style.color='red';
positionDivTxt.style.fontSize='18pt';
positionDivTxt.width='400px';
positionDivTxt.style.whiteSpace='nowrap';
myElement.appendChild(positionDiv);
myElement.appendChild(positionDivBTN);
positionDivBTN.appendChild(positionDivBTNOK);
positionDivBTN.appendChild(positionDivBTNReset);
positionDivBTN.appendChild(positionDivTxt);
doc.getElementById('addstuff').style.display='';
doc.getElementById('gsea').style.display='';
tmpVar.style.minHeight=sFullModeHeight;
tmpVar.style.height= sFullModeHeight;
positionDiv.style.height=doc.getElementById('nhdrwrap').offsetHeight + 'px';
prefManager.setIntPref('extensions.igoogletabremover.intHeadHeight',460);
positionDiv.addEventListener('click',function (e) {
var intH = e.clientY - tmpVar.offsetTop;
if (intH<doc.getElementById('addstuff').offsetTop){
doc.getElementById('addstuff').style.display='none';
}
if (intH<doc.getElementById('btnG').offsetTop +doc.getElementById('btnG').offsetHeight){
doc.getElementById('gsea').style.display='none';
doc.getElementById("igoogletabremoverdivSearchCell").style.display='';
inptSearchToggle.checked=true;
}
positionDiv.style.height=intH +'px';
tmpVar.style.minHeight=intH +'px';
tmpVar.style.height=intH +'px';
prefManager.setIntPref('extensions.igoogletabremover.intHeadHeight',intH);
},false);
positionDivBTNOK.addEventListener('click',function (e) {
positionDiv.style.display='none';
positionDivBTN.style.display='none';
coverDiv.style.display='none';
doc.body.removeChild(coverDiv);
},false);
positionDivBTNReset.addEventListener('click',function (e) {
doc.getElementById('addstuff').style.display='';
doc.getElementById('gsea').style.display='';
tmpVar.style.minHeight=sFullModeHeight;
tmpVar.style.height= sFullModeHeight;
positionDiv.style.height=doc.getElementById('nhdrwrap').offsetHeight + 'px';
prefManager.setIntPref('extensions.igoogletabremover.intHeadHeight',460);
},false);
},false);
}
}
}
}
};
window.addEventListener("load", function(e) { igoogletabremover.onLoad(e); }, false);